package auctioncentral;

import java.util.LinkedList;
import java.util.List;

/**
 * Encapsulates an individual auction item.
 * 
 * @author Kris
 * @version 2/24/2014
 */
public class Item {
  /**Name of the item.*/
  private final String my_name;
  
  /**
   * my unique item id.
   */
  private final int my_id;
  
  /**How many of this item is available.*/
  private final int my_quantity;
  
  /**
   * event this item belongs to.
   */
  private String my_event;
  
  /**
   * The minimum starting bid of the item.
   */
  private final int my_min_starting_bid;
  
  /**
   * The donor who donated the item.
   */
  private final String my_donor;
  
  /**
   * The size of the item.
   */
  private final String my_size;
  
  /**
   * The storage location of the item.
   */
  private final String my_storage;
  
  /**
   * The condition of the item.
   */
  private final String my_condition;
  
  /**
   * The comments about the item.
   */
  private final String my_comments;
  
///**List of bids for this Item.*/
//private final List<Bid> my_bids;

///**Holds the final bid for this item.*/
//private Bid my_final_bid;

  /**
   * Public constructor for the Item class.
   * @param the_name the name of the item.
   * @param the_quantity the number of items available.
   */
  public Item(final String the_name, final int the_quantity, final String the_event, final int the_min_starting_bid, final String the_donor,
      final String the_size, final String the_storage, final String the_condition, final String the_comments) {
    my_name = the_name;
    my_quantity = the_quantity;
    String s = my_name + my_event + my_quantity;
    my_id = Math.abs(s.hashCode())%100000;
    my_event = the_event;
    my_min_starting_bid = the_min_starting_bid;
    my_donor = the_donor;
    my_size = the_size;
    my_storage = the_storage;
    my_condition = the_condition;
    my_comments = the_comments;
    //my_bids = new LinkedList<Bid>();
  }
  
  
  public Item(final String the_name, final int the_quantity, final String the_event, final int the_id, final int the_min_starting_bid, final String the_donor,
      final String the_size, final String the_storage, final String the_condition, final String the_comments) {
    my_name = the_name;
    my_quantity = the_quantity;
    String s = my_name + my_event + my_quantity;
    my_id = the_id;
    my_event = the_event;
    my_min_starting_bid = the_min_starting_bid;
    my_donor = the_donor;
    my_size = the_size;
    my_storage = the_storage;
    my_condition = the_condition;
    my_comments = the_comments;
    //my_bids = new LinkedList<Bid>();
  }
  
//  /**
//   * 
//   * @param the_bid the bid to set the final bid to.
//   */
//  public void setFinalBid(final Bid the_bid) {
//    my_final_bid = the_bid;
//  }
  
//  /**
//   * sets the starting bid to the input bid.
//   * @param the_bid the bid to set the starting bid to.
//   */
//  public void setStartingBid(final Bid the_bid) {
//   // my_bids.add(0, the_bid);
//  }
  
//  /**
//   * adds a bid to the class bid list.
//   * @param the_bid the bid to add.
//   */
//  public void addBid(final Bid the_bid) {
//    my_bids.add(the_bid);
//  }
  
//  /**
//   * the final bid.
//   * @return the final bid for this item.
//   */
//  public Bid getFinalBid() {
//    my_final_bid = my_bids.get(my_bids.size() - 1);
//    return my_final_bid;
//  }
  
  /**
   * returns the name of the item.
   * @return the name of the item.
   */
  public String getName() {
    return my_name;
  }
  
  /**
   * returns the Quantity of the item.
   * @return the Quantity of the item.
   */
  public int getQuantity() {
    return my_quantity;
  }
  
  
  
  public String getMy_event() {
    return my_event;
  }


  public void setMy_event(String my_event) {
    this.my_event = my_event;
  }


  public int getMy_id() {
    return my_id;
  }
  
  

  public String getMy_name() {
    return my_name;
  }


  public int getMy_quantity() {
    return my_quantity;
  }


  public int getMy_min_starting_bid() {
    return my_min_starting_bid;
  }


  public String getMy_donor() {
    return my_donor;
  }


  public String getMy_size() {
    return my_size;
  }


  public String getMy_storage() {
    return my_storage;
  }


  public String getMy_condition() {
    return my_condition;
  }


  public String getMy_comments() {
    return my_comments;
  }


  @Override
  public String toString() {
    String s = my_name + " " + my_id + " " + my_quantity + " " + my_event + " " + my_min_starting_bid + 
        " " + my_donor + " " + my_size + " " + my_storage + " " + my_condition + " " + my_comments;
    return s;
  }
}
